package com.nwpu.coursesupport.view.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.nwpu.coursesupport.controller.AbstractController;
import com.nwpu.coursesupport.entity.bean.JSONResult;

@Controller
@RequestMapping("/taskAssignView")
public class TaskAssignViewController extends AbstractController{

	@RequestMapping("/taskMainListData")
	@ResponseBody
	public JSONResult taskMainListData(@RequestParam("data")String data){
		JSONResult rst=invokeService("taskAssignView", "getTaskMainAssignView", data);
		return rst;
	}
	
	@RequestMapping("/taskMainList")
	public String taskMainList(@RequestParam("taskId")int taskId,HttpServletRequest request){
		JSONResult rst=invokeService("taskAssignView", "getTaskMainAssignView", "{\"taskId\":\"" + taskId + "\"}");
		request.setAttribute("data", this.parseData(rst));
		return "/teapage/courseTaskOtherPublish";
	}
	
	@RequestMapping("/taskInLessonListData")
	@ResponseBody
	public JSONResult taskInLessonListData(@RequestParam("data")String data){
		JSONResult rst=invokeService("taskAssignView", "getTaskInLessonAssignView", data);
		return rst;
	}
	
	@RequestMapping("/taskInLessonList")
	public String taskInLessonList(@RequestParam("taskId")int taskId,HttpServletRequest request){
		JSONResult rst=invokeService("taskAssignView", "getTaskInLessonAssignView", "{\"taskId\":\"" + taskId + "\"}");
		request.setAttribute("data", this.parseData(rst));
		return "/teapage/courseTaskLessonPublish";
	}

}
